THREE.BufferGeometry.prototype.addGeometry = function(geometry) {
    const attributes1 = this.attributes;
    const attributes2 = geometry.attributes
    for ( const key in attributes2 ) {
        // 空bufferGeometry 专用
        if ( attributes1[ key ] === undefined ) {
            let copyAttribute = attributes2[key].clone() 
            attributes1[key] = copyAttribute
            continue
        }
        // 非空bufferAttribute 合并
        let array1 = attributes1[key].array;
        let array1Length = attributes1[key].itemSize * attributes1[key].count
        let array2 = attributes2[key].array;
        let array2Length = attributes2[key].itemSize * attributes2[key].count
        let newArrayLength = array1Length+array2Length
        //console.log(newArrayLength)
        let newArray = new Float32Array(newArrayLength)
        
        for(let i = 0 ; i < array1Length; ++i) {
            newArray[i] = array1[i]
        }
        for(let i = array1Length; i < newArrayLength; ++i) {
            newArray[i] = array2[i-array1Length]
        }
        //this.setAttribute( key, new THREE.BufferAttribute( newArray, 3 ) )
        let newBufferAttribute = new THREE.BufferAttribute(newArray,3)
        attributes1[key] = newBufferAttribute
    }

    return this; 
}
var mergeFloat32 = function(temp1,temp2) {
    let length1 = temp1.length
    let length2 = temp2.length
    let length = length1 + length2
    let newArray = new Float32Array(length) 
    for(let i = 0; i < length1; ++i) {
        newArray[i] = temp1[i]
    }
    for(let i = length1; i < length; ++i) {
        newArray[i] = temp2[i-length1]
    }
    return newArray
}
//递归mesh中的全部Geometry
function findGeometry(obj,famleGeometry) {
    //访问当前层级的geometry
    if(obj.geometry != undefined) {
        famleGeometry.addGeometry(obj.geometry)
    }
    //访问children
    if(obj.children != null || obj.children != undefined) {
        let children = obj.children
        let childrenLength = obj.children.length
        if(childrenLength != 0) {
            for(let i = 0; i < childrenLength; ++i) {
                findGeometry(children[i],famleGeometry)
            }
        }
    }    
}